<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件绑定</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>

<body>
    <div id="Application">
        <div>点击次数:{{count}}</div>

        <!-- 注意传参的方式，点一下增加两个数. 并且一次点击，触发两个函数 -->
        <button @click="click(2), log($event)">点击</button>

        <!-- 下面的事件触发是从内到外的。事件冒泡 -->
        <div @click="click1" style="border:solid red">
            外层
            <div @click="click2" style="border:solid red">
                中层
                <div @click="click3" style="border:solid red">
                    内层
                </div>
            </div>
        </div>
    </div>
    <script>
        const App = {
            data() {
                return {
                    count: 0
                }
            },
            methods: {
                click(step) {
                    this.count += step
                },
                log(event) {
                    console.log(event)
                    console.log(this.count)
                },

                click1() {
                    console.log("外层")
                    console.log("--------")
                },
                click2() {
                    console.log("中层")
                },
                click3() {
                    console.log("内层")
                }
            }
        }
        Vue.createApp(App).mount("#Application") 
    </script>
</body>

</html>